pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let split_res = num_str.split('(').collect::<Vec<&str>>();
    let original_digits = split_res[0];
    let original_base = split_res[1].split(')').collect::<Vec<&str>>()[0]
        .parse::<u32>()
        .unwrap();
    // Just assume the original value is u32
    let original_num = u32::from_str_radix(original_digits, original_base).unwrap();
    let res = u32_to_str_radix(original_num, to_base);
    res
}

fn u32_to_str_radix(num: u32, base: u32) -> String {
    let mut num = num;
    let mut res = String::new();
    while num > 0 {
        let remainder = num % base;
        res.push_str(&remainder_to_one_digit(remainder));
        num /= base;
    }
    res.chars().rev().collect()
}
fn remainder_to_one_digit(remainder: u32) -> String {
    let remainder = remainder as u8;
    assert!(remainder <= 16);
    if remainder < 10 {
        ((remainder + 48) as char).to_string()
    } else {
        ((remainder + 87) as char).to_string()
    }
}
